/**
 * 操作用户信息路由模块
 */
const express = require('express')
const router = express.Router()
const expressJoi = require('@escook/express-joi')
const { add_user_schema, del_user_schema,update_user_schema, ban_user_schema, get_user_all_offset_schema, get_user_byUsername_schema, get_user_byNickname_schema} = require('../schema/userinfo')

// 导入操作用户信息模块
const userinfoHandler = require('../router_handler/userinfo')

/**
 * 管理员
 * 操作用户所有信息
 */
// 增
router.post('/addUserinfo', expressJoi(add_user_schema), userinfoHandler.addUserinfo)

// 删
router.post('/deleteUserinfo', expressJoi(del_user_schema), userinfoHandler.deleteUserinfo)


// 改
router.post('/updateUserinfo', expressJoi(update_user_schema), userinfoHandler.updateUserinfo)
/*封禁用户*/
router.post('/deleteUserinfoOrdinary', expressJoi(ban_user_schema), userinfoHandler.banUserinfoOrdinary)
/*解除封禁用户*/
router.post('/deleteUserinfoOrdinaryCancel', expressJoi(ban_user_schema), userinfoHandler.banUserinfoOrdinaryCancel)
// 修改用户头像
router.post('/updateUserPic', userinfoHandler.updateUserPic)


// 查
/*查全部用户*/
router.get('/getUserinfoAll', userinfoHandler.getUserinfoAll)
/*查询全部普通用户*/ 
router.get('/getUserinfoOrdinary', userinfoHandler.getUserinfoOrdinary)
/*查询全部管理员用户*/ 

/*根据username查某个用户*/
router.get('/getUserinfoByUsername', userinfoHandler.getUserinfoByUsername)
/*根据用户昵称模糊查找*/
router.post('/getUserinfoByNickname', userinfoHandler.getUserinfoByNickname)
/*获取登录后用户信息*/
// router.get('/getUserinfo', userinfoHandler.getUserinfo)


module.exports = router
